package org.millioncall.yueyoga.admin.dao;

import java.util.List;
import java.util.Map;

import org.millioncall.openplatform.common.PaginatedList;
import org.millioncall.yueyoga.admin.dao.entity.ClassEntity;
import org.millioncall.yueyoga.admin.model.AviatorExpression;
import org.millioncall.yueyoga.admin.model.ClassMemberModel;
import org.millioncall.yueyoga.admin.model.ClassProduct;
import org.millioncall.yueyoga.admin.model.ClassRecord;
import org.millioncall.yueyoga.admin.model.Clazz;
import org.millioncall.yueyoga.admin.model.TinyClass;

public interface ClazzDAO {
	public int deleteByPrimaryKey(Integer id);

	public int insert(Clazz record);

	public boolean saveClassEntity(ClassEntity entity);

	public boolean updateClassEntity(ClassEntity entity);

	public int insertSelective(Clazz record);

	public Clazz selectByPrimaryKey(Integer id);

	public int updateByPrimaryKeySelective(Clazz record);

	public int updateByPrimaryKeyWithBLOBs(Clazz record);

	public int updateByPrimaryKey(Clazz record);

	public PaginatedList<ClassRecord> findClazzPage(Integer start, Integer limit, Map<String, Object> map);

	public Clazz findById(Map<String, Object> map);

	public ClassEntity findByClassId(Map<String, Object> map);

	public List<TinyClass> findAllClassTiny(Map<String, Object> map);

	/**
	 * 批量删除
	 * 
	 * @param Ids
	 * @return
	 */
	public int deleteClazzByIds(List<Integer> Ids);

	public String findClassCode();

	public boolean addMemberToClass(Integer classId, Integer memberId,
			String createdById);

	public boolean addProductToClass(Integer classId, Integer productId,
			String productName, String createdById);

	public boolean deleteMemberOfClass(Integer classId, List<Integer> memberIds);

	public boolean deleteProductOfClass(Integer classId,
			List<Integer> productIds);

	// 班级会员数
	public int countOfMember(Integer classId, Integer memberId);

	public int countOfProduct(Integer classId, Integer productId);

	/**
	 * 查询班级会员
	 * 
	 * @return
	 */
	public PaginatedList<ClassMemberModel> findClassMembersByClassId(Map<String, Object> map, int start, int limit);

	public List<ClassProduct> findClassProduct(Map<String, Object> map);
	/**
	 * 根据产品编号，查询有该产品的班级
	 * Integer ProductId
	 * @return List<Clazz>
	 */
	public List<Clazz> findClassByProductId(Integer id);
	
	/**
	 * 查询所有符合aviator表达式的班级
	 * 
	 * @param expression
	 * @param params
	 * @param start
	 * @param limit
	 * @return
	 */
	public List<ClassRecord> getAllClazzWithAviator(Map<String, Object> params,
			AviatorExpression expression, Map<String, Object> aviatorParams,
			int limit);

	public List<Clazz> findWeiXinClassByMap(Map<String, Object> maps);
}